from bdtime import tt
import pyautogui
import pydirectinput


allWindows = pyautogui.getAllWindows()


## 打印所有活动窗口
for win32Window in allWindows:
    if win32Window.title == '原神':
        target_window: pyautogui.Window = win32Window
    print("打印所有活动窗口:", win32Window)


target_window._getWindowRect()
target_window.left = 0
target_window.top= 0


print('======= start =============')

tt.sleep(2)

print('~~~~~~~~~~~~~~~~~~~~~~')


for i in range(1000):
    if tt.stop_alt('s'):
        break

    pyautogui.keyDown('w')  # 按住Enter键不释放
    pyautogui.keyUp('w')  # 按住Enter键不释放

    if tt.stop_alt('s'):
        break

    pyautogui.keyDown('s')  # 按住Enter键不释放
    pyautogui.keyUp('s')  # 按住Enter键不释放


    pyautogui.keyDown('a')  # 按住Enter键不释放
    pyautogui.keyUp('a')  # 按住Enter键不释放


    pyautogui.keyDown('d')  # 按住Enter键不释放
    pyautogui.keyUp('d')  # 按住Enter键不释放


print('======= end =============')
